<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>绑定微信</title>
</head>
<body>

正在绑定微信!

</body>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="utils.js"></script>
<script>
    // 微信扫码后将重定向到这个页面进行微信静默授权,并由指定给微信的回调页面获取到微信的信息
    function bindWx() {
        let params = getUrlParams();
        // 推荐人ID
        let referrer = params["ref"];
        // appId
        let appId = params["appId"];
        // 重定向的URL
        let redirect_uri = "http://imopei.95by.cn/goto/wxCallBack.html";
        redirect_uri = encodeURIComponent(redirect_uri);
        let url = "https://open.weixin.qq.com/connect/oauth2/authorize?" +
            "appid=" + appId +
            "&redirect_uri=" + redirect_uri +
            "&response_type=code" +
            "&scope=snsapi_base" +
            "&state=" + referrer + "#wechat_redirect";
        alert(url);
        window.location.replace(url);
    }

    window.onload = function () {
        bindWx();
    }

</script>
</html>